package eu.boss.controller;

import eu.boss.model.PlayerList;
import eu.boss.model.TeamList;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

/**
 * Service used as a MVC controller
 * @author Arnaud
 *
 */
public class ShadowStatsController extends Service {
	/**
	 * @param mBinder
	 * @param mPlayers playerList
	 */
	private final IBinder mBinder = new LocalBinder();
	private PlayerList mPlayers;
	private TeamList mTeamList;
	private String mHash;
	
	/**
	 * Class used for the client Binder. Because we know this service always
	 * runs in the same process as its clients, we don't need to deal with IPC.
	 */
	public class LocalBinder extends Binder {
		public ShadowStatsController getService() {
			// Return this instance of LocalService so clients can call public
			// methods
			return ShadowStatsController.this;
		}
	}

	@Override
	public IBinder onBind(Intent arg0) {
		return mBinder;
	}

	public PlayerList getPlayersList() {
		return mPlayers;
	}

	public void setPlayersList(PlayerList players) {
		if (players==null)
			mPlayers=new PlayerList();
		else
			mPlayers = new PlayerList(players);
	}

	public TeamList getTeamList() {
		return mTeamList;
	}

	public void setTeamList(TeamList teamList) {
		if (mTeamList==null)
			mTeamList=new TeamList("vide");
		else 
			mTeamList = new TeamList(teamList);
	}

	public String getHash() {
		return mHash;
	}

	public void setHash(String hash) {
		this.mHash = hash;
	}

	
}
